package com.example.cunwan_hd.Server;

import com.example.cunwan_hd.Mapper.DataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
public class DsService {
    private static int a = 0;
    private static int b = 0;
    private static int c = 0;


    public static int getA() {
        return a;
    }

    public static void setA(int a) {
        DsService.a = a;
    }

    @Autowired
    DataMapper dataMapper;
    @Autowired WebSocket webSocket;

    @Scheduled(fixedDelay = 1000 * 60)
    public void ds() {
        if (b != a) {


            System.out.println("b!=a");
            b = a;
        } else {





            System.out.println();
            webSocket.onMessage((String) dataMapper.get().get("data"),"system","1234");


        }

    }
}
